package com.hqyj.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Payment {
    private int paymentid;
    private int orderid;
    private Date paymenttime;
    private double paymentmount;
    private int paymentstatus;

    public void setPaymenttime(String paymenttime) throws ParseException {
        SimpleDateFormat inputFormat = null;
        if(paymenttime.contains("T")){
            inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
        }else{
            inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        }
        this.paymenttime = inputFormat.parse(paymenttime);
    }
    public void setPaymenttime(Date paymenttime){
        this.paymenttime = paymenttime;
    }
}
